#pragma once

#include <QtGui/QFrame>
#include <QtGui/QPushButton>
#include <QtGui/QComboBox>
#include <QtGui/QLabel>
#include <QtGui/QCheckbox>
#include <QtGui/QRadioButton>

#include "MikinolSensor.h"
#include "MikinolQImageWidget.h"
#include "MikinolQColorCameraSettingsWidget.h"

namespace Mikinol
{

class QCameraWidget :	public QFrame,
						public Sensor::Listener
{ 
	Q_OBJECT

public:
	enum CameraType
	{
		ColorCamera,
		DepthCamera
	};

	QCameraWidget( QWidget* parent, Sensor* sensor, CameraType cameraType );
	virtual ~QCameraWidget();

	Sensor*					getSensor() const { return mSensor; }

protected:
	virtual void			onInitialize( Sensor* sensor );
	virtual void			onShutdown( Sensor* sensor );
	virtual void			onCapturedColorImage( Sensor* sensor );
	virtual	void			onCapturedDepthImage( Sensor* sensor );
	
private slots:
	void					startButtonPressed();

private:
	static bool				convertDepthImageWithPlayerIndexToBGRX32Image( const Image& grayscale16Image, Image& bgrx32Image );

	Sensor*					mSensor;
	CameraType				mCameraType;
	
	QImageWidget*			mImageWidget;
	QComboBox*				mCaptureSettingsCombo;
	QCheckBox*				mDepthNearModeCheckBox;
	QCheckBox*				mIncludePlayerIndexCheckBox;
	QPushButton*			mStartButton;
	QLabel*					mImageNumberLabel;

	QColorCameraSettingsWidget* mColorCameraSettingsWidget;			// Only for Color Camera
	Image*						mBGRXDepthImageWithPlayerIndex;		// Only for DepthCamera
};

}
